package com.itheima;

import com.itheima.properties.AipFaceProperties;
import com.itheima.properties.HuanXinProperties;
import com.itheima.properties.OssProperties;
import com.itheima.properties.SmsProperties;
import com.itheima.template.AipFaceTemplate;
import com.itheima.template.HuanXinTemplate;
import com.itheima.template.OssTemplate;
import com.itheima.template.SmsTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

//配置包
//自动装配类
@EnableConfigurationProperties({
        //将这些类加入spring封装成对象 放入容器中使用
        SmsProperties.class,
        OssProperties.class,
        AipFaceProperties.class,
        HuanXinProperties.class
})
public class TanhuaAutoConfiguration {
    //短信服务
    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties) {
        return new SmsTemplate(smsProperties);
    }
    //阿里oss储存图片服务
    @Bean
    public OssTemplate ossTemplate(OssProperties properties) {
        return new OssTemplate(properties);
    }
    //人脸识别服务
    @Bean
    public AipFaceTemplate aipFaceTemplate() {
        return new AipFaceTemplate();
    }

    //环信服务
    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties properties) {
        return new HuanXinTemplate(properties);
    }
}
